from todo_api_protect.base.mybase import Tools

class login_model(Tools):
    # 定义路径
    path = '/user/login'

    # 发送登录请求
    def login_action(self, usr, pwd, check='1234'):
        login_data = {
            "username": usr,
            "password": self.md5(pwd),
            "checkcode": check
        }
        login = self.meeting.post(url=self.hosturl+self.path, data=login_data)
        return login.json()

import requests
s = requests.session()
login = login_model(meeting=s)
msg = login.login_action(usr='admin10023', pwd='admin123', check='1234')
print(msg)
